<template>
  <section>
    <div class="model mywork">
      <img :src="IMGBASE64.WODEGONGZUO2X" class="pink">
      <span class="title">故障列表</span>
      <div class="kong"></div>
      <template>
        <el-table :data="tablemsg" style="width: 100%">
          <el-table-column prop="repairName" label="报修人" align="center"></el-table-column>
          <el-table-column prop="repairPhone" label="联系电话" align="center" :show-overflow-tooltip='true'></el-table-column>
          <el-table-column prop="typeName" label="故障类别" align="center"></el-table-column>
          <el-table-column prop="repairPlace" label="故障地点" align="center" :show-overflow-tooltip='true'></el-table-column>
          <el-table-column prop="faultDesc" label="故障描述" align="center" :show-overflow-tooltip='true'></el-table-column>
          <el-table-column prop="repairTime2" label="报修时间" align="center" :show-overflow-tooltip='true'></el-table-column>
          <el-table-column prop="repaireStatus2" label="维修状态" align="center"></el-table-column>
          <el-table-column prop="repaireReply" label="维修反馈" align="center" :show-overflow-tooltip='true'></el-table-column>
          <el-table-column prop="replyTime2" label="维修时间" align="center" :show-overflow-tooltip='true'></el-table-column>
        </el-table>
        <el-pagination
          v-show="paging"
          @current-change="handleCurrentChange"
          :page-size="20"
          layout="prev, pager, next, jumper"
          :total="total"
          class="pull-right">
        </el-pagination>
      </template>
    </div>
  </section>
</template>

<script>
export default {
  data () {
    return {
      total: 0,
      page: 1,
      paging: true,
      tablemsg: [{
        id: '1',
        who: '李俊义',
        phone: '13241234123',
        type: '待维修',
        where: '2号教学楼406',
        main: '白板打开后，无法使用',
        time: '2015/03/23 12:21:12',
        status: '待维修',
        return: '白板打开后，无法使用',
        when: '2015/03/23 12:21:12'
      },
      {
        id: '2',
        who: '李俊义',
        phone: '13241234123',
        type: '待维修',
        where: '2号教学楼406',
        main: '白板打开后，无法使用',
        time: '2015/03/23 12:21:12',
        status: '待维修',
        return: '白板打开后，无法使用',
        when: '2015/03/23 12:21:12'
      },
      {
        id: '3',
        who: '李俊义',
        phone: '13241234123',
        type: '已维修',
        where: '2号教学楼406',
        main: '白板打开后，无法使用',
        time: '2015/03/23 12:21:12',
        status: '待维修',
        return: '白板打开后，无法使用',
        when: '2015/03/23 12:21:12'
      }]
    }
  },
  mounted () {
    // let _cookie = document.cookie.split(';')
    // let _cookieArray = []
    // _cookie.forEach(v => {
    //   let _d = v.split('=')
    //   _cookieArray.push({
    //     key: _d[0],
    //     value: _d[1]
    //   })
    // })
    this.$http.post(this._httpUrl + 'fault/repair/category', {
      page: this.page,
      rows: 20
    }, {'headers': {'yxt-xtoken': localStorage.xtoken}}).then(function (response) {
      if (response.body.code === '000') {
        // console.log(response.data.data.content)
        this.tablemsg = response.data.data.rows
      } else if (response.body.code === '887') {
        this.$router.push('/')
      } else if (response.body.code === '889') {
        this.$router.push('/')
      }
    })
  },
  methods: {
    handleCurrentChange (val) {
      this.page = val
      this.getStudentNameData()
    }
  }
}
</script>

<style lang="less" scoped>
@import '/static/css/all-use.css';
</style>
